<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>


<!DOCTYPE html >
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

	<head>
	
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
		<title>商城网上商城</title>
		<link rel="stylesheet" type="text/css" href="css1/style.css" />
		<link rel="stylesheet" type="text/css" href="css1/css.css" />
		<link rel="stylesheet" type="text/css" href="css/gwc.css" />
		<script type="text/javascript" src="js/jquery-1.12.4.js"></script>
		
		<script type="text/javascript">
			$(function() {
				var region = $("#region");
				var address = $("#address");
				var number_this = $("#number_this");
				var name = $("#name_");
				var phone = $("#phone");
				$("#sub_setID").click(function() {
					var input_out = $(".input_style");
					for (var i = 0; i <= input_out.length; i++) {
						if ($(input_out[i]).val() == "") {
							$(input_out[i]).css("border", "1px solid red");

							return false;
						} else {
							$(input_out[i]).css("border", "1px solid #cccccc");
						}
					}
				});
				var span_momey = $(".span_momey");
				var b = 0;
				for (var i = 0; i < span_momey.length; i++) {
					b += parseFloat($(span_momey[i]).html());
				}
				var out_momey = $(".out_momey");
				out_momey.html(b);
				$(".shade_content").hide();
				$(".shade").hide();
				$('.nav_mini ul li').hover(function() {
					$(this).find('.two_nav').show(100);
				}, function() {
					$(this).find('.two_nav').hide(100);
				})
				$('.left_nav').hover(function() {
					$(this).find('.nav_mini').show(100);
				}, function() {
					$(this).find('.nav_mini').hide(100);
				})
				$('#jia').click(function() {
					$('input[name=num]').val(parseInt($('input[name=num]').val()) + 1);
				})
				$('#jian').click(function() {
					$('input[name=num]').val(parseInt($('input[name=num]').val()) - 1);
				})
				$(document).on("click",".Caddress .add_mi",function() {
					  var dizhi=$(".p1").html();
	                  var dizhi1=$(".add_mi .p2").html();
	                  var dizhi2=$(".add_mi .p3").html();
	                  
					  $(this).css('background', 'url("images/mail_1.jpg") no-repeat').siblings('.add_mi').css('background',
						'url("images/mail.jpg") no-repeat');
					  $.getJSON("orderress",{"address":dizhi1},function(addlist){	
		                   
	                    });
				})
			})
			var x = Array();

			function func(a, b) {
				x[b] = a.html();
				alert(x)
				a.css('border', '2px solid #f00').siblings('.min_mx').css('border', '2px solid #ccc');
			}

			function onclick_close() {
				var shade_content = $(".shade_content");
				var shade = $(".shade");
				if (confirm("确认关闭么！此操作不可恢复")) {
					shade_content.hide();
					shade.hide();
				}
			}

			function onclick_open() {
				$(".shade_content").show();
				$(".shade").show();
				var input_out = $(".input_style");
				for (var i = 0; i <= input_out.length; i++) {
					if ($(input_out[i]).val() != "") {
						$(input_out[i]).val("");
					}
				}
			}

			function onclick_remove(r) {
				if (confirm("确认删除么！此操作不可恢复")) {
					var out_momey = $(".out_momey");
					var input_val = $(r).parent().prev().children().eq(1).val();
					var span_html = $(r).parent().prev().prev().children().html();
					var out_add = parseFloat(input_val).toFixed(2) * parseFloat(span_html).toFixed(2);
					var reduce = parseFloat(out_momey.html()).toFixed(2) - parseFloat(out_add).toFixed(2);
					console.log(parseFloat(reduce).toFixed(2));
					out_momey.text(parseFloat(reduce).toFixed(2))
					$(r).parent().parent().remove();
				}
			}

			function onclick_btnAdd(a) {
				var out_momey = $(".out_momey");
				var input_ = $(a).prev();
				var input_val = $(a).prev().val();
				var input_add = parseInt(input_val) + 1;
				input_.val(input_add);
				var btn_momey = parseFloat($(a).parent().prev().children().html());
				var out_momey_float = parseFloat(out_momey.html()) + btn_momey;
				out_momey.text(out_momey_float.toFixed(2));
			}

			function onclick_reduce(b) {
				var out_momey = $(".out_momey");
				var input_ = $(b).next();
				var input_val = $(b).next().val();
				if (input_val <= 1) {
					alert("商品个数不能小于1！")
				} else {
					var input_add = parseInt(input_val) - 1;
					input_.val(input_add);
					var btn_momey = parseFloat($(b).parent().prev().children().html());
					var out_momey_float = parseFloat(out_momey.html()) - btn_momey;
					out_momey.text(out_momey_float.toFixed(2));
				}
			}
		</script>
	</head>

	<body>
		<!--网页头部-->
<%@include file="hade.jsp" %>
		<!-- 搜索区域开始 -->
		
		
		<div id="gw_dz">

		</div>
		<!-- <form action=""> -->
		  <input type="hidden" id="addr" />
		  
		<div class="Caddress">
			<div class="open_new">
				<a class="open_btn" >使用新地址</a>
			</div>
		</div>
		
		<script type="text/javascript">
		   $(function(){
			   $.getJSON("addjson",function(addlist){	
                   //用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
                   //var flalist=$.parseJSON(result);
                    for(var i in addlist){
                       $(".Caddress").append("<div class=\"add_mi\">"
               				+"<p class=\" p1\" style=\"border-bottom:1px dashed #ccc;line-height:28px;\">"+addlist[i].city+"("+addlist[i].name+"收)</p>"
               				+"<p class=\" p2\"  >"+addlist[i].address+"</p>"
               				+"<p class=\" p3\"  >"+addlist[i].phone+"</p>"
               				+"</div>");
                       }
                    
                    });
		   })
		</script>
		<!--
        	作者：z@163.com
        	时间：2016-03-04
        	描述：商品内容
        -->
		<div class="yitiaoxian"></div>
		<div class="wrap">
			<table class="order_table">
				<caption>
					<strong>订单商品</strong>
				</caption>
			</table>
			<script type="text/javascript">
			
			 $(function(){
				 $.getJSON("carts",function(shopslist){	
	                   //用于将符合标准格式的的JSON字符串转为与之对应的JavaScript对象			  
	                   //var flalist=$.parseJSON(result);
	                        var num=0;
	                    	for(var j in shopslist.list){	
	                        num=shopslist.list[j].shoporice*shopslist.list[j].kucun+num;
	                       $(".order_table").append("<tr class=\"shanpin_kuang\">"
	           					+"<td class=\"center\"><a href=\"product.html\"><img src=\"upload/"+shopslist.list[j].shopimg+"\" style=\"width:50px;height:50px;\" /></a></td>"
	           					+"<td style=\"width:200px;\"><a href=\"product.html\">"+shopslist.list[j].shopname+"</a></td>"
	           					+"<td>"
	           					+"<p>种类："+shopslist.list[j].kind+"</p>"
	           					+"<p>品牌："+shopslist.list[j].brand+"</p>"
	           					+"</td>"
	           					+"<td class=\"center\"><span class=\"rmb_icon\">"+shopslist.list[j].shoporice+"</span></td>"
	           					+"<td class=\"center\"><span>"+shopslist.list[j].kucun+"</span></td>"
	           					+"<td class=\"center\"><strong class=\"rmb_icon\">"+shopslist.list[j].shoporice*shopslist.list[j].kucun+"</strong></td>"
	           					+"</tr>");  
	                    };
	                    $(".rmb").html("");
	                    $(".rmb").append(num);
	                    }); 
			   })
			
			</script>
			<!--支付与配送-->
			<ul class="order_choice">
				<li>
					<dl>
						<dt>支付方式</dt>
						<dd>
							<label class="radio istrue"><input type="radio" name="pay" value="支付宝" checked />支付宝</label>
							<label class="radio"><input type="radio" name="pay" id="wx_zf" />微信支付</label>
							<label class="radio"><input type="radio" name="pay" id="wy" />网银在线</label>
						</dd>

					</dl>
				</li>
				<li>

				</li>

			</ul>
			<div class="order_btm_btn">
				<a href="alipay" id="money" class="link_btn_02 add_btn" />共计金额<strong class="rmb">0.00</strong>提交订单</a>
			</div>
		</div>
		<script type="text/javascript">
		   $(function(){
			   $("#money").click(function(){
				   $.getJSON("addorder",function(addlist){	
		                  
                   });
				   
			   })
			   
		   })
		</script>
		<!-- <input type="button" value="点击就送"/>
		</form> -->
		<div class="yitiaoxian"></div>

		<!--
        	作者：z@163.com
        	时间：2016-03-01
        	描述：shade 遮罩层
        -->
	<!--
        	作者：z@163.com
        	时间：2016-03-02
        	描述：shade_content
        -->
		

		<!-- 底部开始 -->
<!--网页底部-->
<%@include file="foot.jsp" %>
		<!-- 底部结束 -->
	</body>

</html>
